﻿using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using bdnt_pets_system_Bo;
using bdnt_pets_system_Entity;
using System.Collections.Generic;
using bdnt_pets_system_Bo.SystemManager;

namespace bdnt_pets_system.Web.Services
{
    [ServiceContract(Namespace = "")]
    //[SilverlightFaultBehavior]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class SystemService
    {
        MenuManager mManger = new MenuManager();
        RoleManager rManager = new RoleManager();
        DictInfoManager dManager = new DictInfoManager();
        EmployeeManager eManager = new EmployeeManager();

        [OperationContract]
        public void DoWork()
        {
            // 在此处添加操作实现
            return;
        }

        // 在此处添加更多操作并使用 [OperationContract] 标记它们

        #region 菜单
        [OperationContract]
        public List<Tbl_Menu> GetAllMenuList()
        {
            return mManger.GetAllMenuList();
        }

        [OperationContract]
        public List<Tbl_Menu> GetMainMenuList()
        {
            return mManger.GetMainMenuList();
        }

        [OperationContract]
        public bool SaveMenu(Tbl_Menu cuMenu)
        {
            return mManger.SaveMenu(cuMenu);
        }

        [OperationContract]
        public bool DeleteMenuObj(Int32 objId)
        {
            return mManger.DeleteCuObj(objId);
        }

        [OperationContract]
        public List<Tbl_Menu> GetAllMenuListByCondition(string roleIds)
        {
            return mManger.GetAllMenuListByCondition(roleIds);
        }

        #endregion

        #region 权限
        [OperationContract]
        public List<Tbl_Role> GetRoleObjListCondition(string rolName)
        {
            return rManager.GetObjListByCondition(rolName);
        }

        [OperationContract]
        public bool SaveRoleObj(Tbl_Role cuObj, List<int> menuIds)
        {
            return rManager.SaveObj(cuObj, menuIds);
        }

        [OperationContract]
        public Tbl_Role GetRoleObjById(int objId)
        {
            return rManager.GetObjById(objId);
        }
        [OperationContract]
        public bool DeleteRoleObj(Int32 objId)
        {
            return rManager.DeleteCuObj(objId);
        }
        #endregion

        #region 员工用户
        [OperationContract]
        public List<Tbl_Employee> GetEmployeeObjListCondition(string objName)
        {
            return eManager.GetObjListByCondition(objName);
        }

        [OperationContract]
        public bool SaveEmployeeRoleObj(Tbl_Employee cuObj)
        {
            return eManager.SaveObj(cuObj);
        }

        [OperationContract]
        public Tbl_Employee GetEmployeeObjById(int objId)
        {
            return eManager.GetObjById(objId);
        }

        [OperationContract]
        public Tbl_Employee GetEmployeeByNameAndPwd(string name, string pwd)
        {
            return eManager.GetObjByNameAndPwd(name, pwd);
        }

        [OperationContract]
        public bool DeleteEmployeeObj(Int32 objId)
        {
            return eManager.DeleteCuObj(objId);
        }
        #endregion

        #region 数据字典
        [OperationContract]
        public List<Tbl_DictInfo> GetDictObjListCondition(string objName)
        {
            return dManager.GetObjListByCondition(objName);
        }

        [OperationContract]
        public bool SaveDictObj(Tbl_DictInfo cuObj)
        {
            return dManager.SaveObj(cuObj);
        }
        [OperationContract]
        public Tbl_DictInfo GetDictInfoObjById(int objId)
        {
            return dManager.GetObjById(objId);
        }
        [OperationContract]
        public bool DeleteDictObj(Int32 objId)
        {
            return dManager.DeleteCuObj(objId);
        }

        [OperationContract]
        public List<Tbl_DictInfo> GetDictListByPid(int objId)
        {
            return dManager.GetObjListByPid(objId);
        }
        #endregion
    }
}
